package com.sgb.kjwl.viewmodel.manage;

import androidx.lifecycle.MutableLiveData;

import com.sgb.kjwl.api.APIManager;
import com.sgb.kjwl.view.ui.fragment.manage.DemandAnnouncementForWebsite;
import com.swgk.core.base.BaseViewModel;
import com.swgk.core.base.api.ICallBack;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.util.PickSelectEntity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DemandAnnouncementForWebsiteModel extends BaseViewModel {

    private DemandAnnouncementForWebsite fragment;
    private Map<String, Object> map = new HashMap<>();

    public DemandAnnouncementForWebsiteModel(DemandAnnouncementForWebsite fragment) {
        this.fragment = fragment;
    }


    public MutableLiveData<List<PickSelectEntity>> mMenus = new MutableLiveData<>();
    public void getSecondMenus(String siteNo, String siteType){
        map.put("siteNo", siteNo);
        map.put("siteType", siteType);
        map.put("type", 2);//2需求公告
        APIManager.getInstance().getWebsiteInfoAPI().getWebsiteSecondMenu(map).enqueue(new ICallBack<BaseEntity<List<PickSelectEntity>>>(true, true) {
            @Override
            public void onSuccess(BaseEntity<List<PickSelectEntity>> data) {
                if (data.getData() != null){
                    mMenus.postValue(data.getData());
                }
            }
        });


    }
}
